interface MouseListenerPeocess {
  mouseDown(): void;
  mouseMove(): void;
  mouseLeave(): void;
  mouseEnter(): void;
}

// 抽象类
abstract class MouseListenerPeocessAdapter implements MouseListenerPeocess {
  abstract mouseDown(): void;
  abstract mouseEnter(): void;
  mouseMove(): void {
    throw new Error('Method not implemented.');
  }
  mouseLeave(): void {
    throw new Error('Method not implemented.');
  }
}

/* 
  这里不直接实现接口是为了更好的控制要实现的方法，可以不用直接实现所有的方法，灵活性变高
*/
class MyMouseListenerPeocess extends MouseListenerPeocessAdapter {
  mouseDown(): void {
    throw new Error('Method not implemented.');
  }
  mouseEnter(): void {
    throw new Error('Method not implemented.');
  }
}

// 自定义类型守卫
function isString(str: any): str is string {
  return typeof str === 'string';
}

function func(data: any) {
  if (isString(data)) {
    data.replace('a', '');
  }
}

interface Func1 {
  (name: string): number;
}




